#pragma once
#include <arpa/inet.h>
void perr_exit(const char *s);

void printAddr(const char*s, struct sockaddr_in* addr);

int Socket(int family, int type, int protocol);

int Bind(int fd, const struct sockaddr* addr, socklen_t addrlen);

int Connect(int fd, const struct sockaddr* addr, socklen_t addrlen);

int Listen(int fd, int backlog);

int Accept(int fd, struct sockaddr* addr, socklen_t *addrlen);

ssize_t Read(int fd, void* ptr, size_t nbytes);

ssize_t Write(int fd, const void* ptr, size_t nbytes);

int Close(int fd);

ssize_t Readn(int fd, void* vptr, size_t n);

ssize_t Writen(int fd, const void* vptr, size_t n);

ssize_t Readline(int fd, void* vptr, size_t maxlen);